


        var zIndex = 1;
        var updating = false;
        var max = 0;
        var watchWindowWidth = null;
        var readyUpadate = null;
        var indexRecord = index = 0;
        function updateTop(){
                var txtHeightHalf = $('main .projects .content .txt').height() / 2 + 'px';
                var iTop = ('calc(50% - ' + txtHeightHalf + ' + 30px + 2.9vw * 1.7 * 0.4)');
                var roundTop = ('calc(50% - ' + txtHeightHalf + ' + 30px + 2.9vw * 1.7 * 0.4 - 5px)');
                $('main .projects .content i')[0].style.top = iTop;
                $('main .projects .content .round')[0].style.top = roundTop;
        }

        function cuttingSwitch(prev,now){
                zIndex++;
                updating = true;
                $('main .projects .content .chooseMenu .box a').removeClass('current');
                $('main .projects .content .chooseMenu .box a:eq(' + now + ')').addClass('current');
                $('main .projects .cutPics .palace .clip:eq(' + now + ')').css('z-index',zIndex);

                setTimeout(function(){
                        for(var n = 0;n < now;n++){
                                $('main .projects .content .txt p:eq(' + n + ')').addClass('tp');
                        }
                        for(var n = now + 1;n < $('main .projects .content .chooseMenu .box a').length;n++){
                                $('main .projects .content .txt p:eq(' + n + ')').removeClass('toTop');
                                $('main .projects .content .txt p:eq(' + n + ')').removeClass('tp');
                        }
                        $('main .projects .content .txt p:eq(' + now + ')').removeClass('tp');
                        $('main .projects .content .txt p:eq(' + now + ')').addClass('toTop');
                        $('main .projects .content .txt p:eq(' + now + ')').addClass('current');
                        if(now > prev){
                                for(var n = 0;n < now;n++){
                                        $('main .projects .cutPics .palace .clip:eq(' + n + ')').addClass('atRht');
                                        $('main .projects .cutPics .palace .clip:eq(' + n +')').addClass('rht');
                                }
                                
                                //$('main .projects .cutPics .palace .clip:eq(' + prev +')').addClass('rht');
                        }else if(now < prev){
                                $('main .projects .cutPics .palace .clip:eq(' + now +')').removeClass('rht');
                                for(var n = now + 1;n < $('main .projects .content .chooseMenu .box a').length;n++){
                                        $('main .projects .cutPics .palace .clip:eq(' + n + ')').removeClass('atRht');
                                        $('main .projects .cutPics .palace .clip:eq(' + n +')').removeClass('toRht');
                                        $('main .projects .cutPics .palace .clip:eq(' + n +')').removeClass('rht');
                                }
                                $('main .projects .content .txt p:eq(' + prev + ')').removeClass('tp');
                                //$('main .projects .cutPics .palace .clip:eq(' + prev +')').removeClass('toRht');
                        }
                        $('main .projects .cutPics .palace .clip:eq(' + now + ')').addClass('current');
                        $('main .projects .cutPics .palace .clip:eq(' + now + ')').addClass('toRht');
                },10)

                setTimeout(function(){
                        console.log('end:',updating);
                        $('main .projects .cutPics .palace .clip:eq(' + prev + ')').removeClass('current');
                        $('main .projects .content .txt p:eq(' + prev + ')').removeClass('current');
                },1010);
                setTimeout(function(){
                        updating = false;
                },1060);
        }
        $(document).ready(function(){
                
                $('main .projects .content .chooseMenu .box a:eq(' + index + ')').addClass('current');
                $('main .projects .cutPics .palace .clip:eq(' + index + ')').addClass('current');
                $('main .projects .cutPics .palace .clip:eq(' + index + ')').addClass('toRht');
                for(var c = 0;c < $('main .projects .cutPics .palace .clip').length;c++){
                        $('main .projects .cutPics .palace .clip')[c].ind = c;
                        var box = $('main .projects .cutPics .palace .clip:eq(' + c + ')').html();
                        for(var n = 0;n < 3;n++){
                                $('main .projects .cutPics .palace .clip:eq(' + c + ')').append(box);
                        }
                        for(var l = 0;l < $('main .projects .content .chooseMenu .box a').length;l++){
                                $('main .projects .content .chooseMenu .box a')[l].ind = l;
                        }
                }
                for(var m = 0;m < $('main .projects .content .txt p').length;m++){
                        if($('main .projects .content .txt p')[m].innerText.length >= $('main .projects .content .txt p')[max].innerText.length){
                                max = m;
                        }
                        var innerText = $('main .projects .content .txt p')[m].innerText;
                        var innerHtml = '';
                        for(var d = 0;d < Math.ceil(innerText.length / 13);d++){
                                var box = '<div class="box"><div>';
                                box += innerText.substr(d * 13,13);
                                box += '</div></div>';
                                innerHtml += box;
                        }
                        $('main .projects .content .txt p')[m].innerHTML = innerHtml;
                }

                $('main .projects .content .txt p:eq(' + max + ')').addClass('max');
                $('main .projects .content .chooseMenu .box a').mouseenter(function(){
                        
                        if($('main .projects .content .chooseMenu')[0].className.indexOf('pointer') < 0) return false;
                        var preCurrent;
                        

                        if(updating){
                                preCurrent = index;
                                if($(this)[0].ind == preCurrent) return false;
                                indexRecord = $(this)[0].ind;
                                clearInterval(readyUpadate);
                                readyUpadate = setInterval(function(){
                                        if(!updating){
                                                clearInterval(readyUpadate);
                                                cuttingSwitch(preCurrent,indexRecord);
                                                index = indexRecord;
                                        }
                                },10);
                        }else{
                                preCurrent = index;
                                if($(this)[0].ind == preCurrent) return false;
                                index = $(this)[0].ind;
                                cuttingSwitch(preCurrent,index);
                        }
                })
                updateTop();
                watchWindowWidth = setInterval(function(){
                        if(window.innerWidth != originalWidth){
                                updateTop();
                                originalWidth = window.innerWidth;
                        }
                },10)
        })